﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace login
{
    public partial class TakePhotoForm : Form
    {
        private String uimstring;
        private String srmlstring;
        private UserInfoModel uim;
        private Bitmap head;

        public TakePhotoForm(String uimstring, String srmlstring)
        {
            this.uimstring = uimstring;
            this.srmlstring = srmlstring;
            this.uim = new UserInfoModel();
            this.uim = this.uim.JsonToEntity(uimstring);
            this.head = new Bitmap("test.bmp") ;
            InitializeComponent();
            this.StartPosition = FormStartPosition.CenterScreen;
        }



        private void buttonconfirm_Click(object sender, EventArgs e)
        {
            MemoryStream ms = new MemoryStream();
            head.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
            uim.HeadPortrait = new Byte[ms.Length];
            uim.HeadPortrait = ms.ToArray();
            uimstring = uim.EntityToJson(uim);
            FingerForm fingerform = new FingerForm(uimstring, srmlstring);
            this.Hide();
            fingerform.Show();
        }

        private void buttonback_Click(object sender, EventArgs e)
        {
            RegisterInfoForm registerinfoform = new RegisterInfoForm();
            this.Hide();
            registerinfoform.Show();
        }

        private void buttontakephoto_Click(object sender, EventArgs e)
        {

        }




    }
}
